<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/pagination.tld" prefix="page"%>
<%
	String path = request.getContextPath();
	String month = "1";
	if(null!=request.getParameter("month")){month = request.getParameter("month");}
	if(null!=request.getAttribute("month")){month = (String)request.getAttribute("month");}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'yuezhuzi_content.jsp' starting page</title>    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="<%=path %>/reference/js/jquery.js"></script>
	<script type="text/javascript">
		//删除月主题内容
		function delmonthcontent(id){
			if(window.confirm("确定要删除吗？")){
			var month = $("#month").val();
			window.location.href="<%=path %>/beike/cmonthcontent.do?method=delMonthContent&ctid="+id+"&month="+month+"&targetId=${targetId}&edit=${edit}&areaId=${areaId}";
			}
			
		}
		function editcontent(tid){
				
				document.getElementById("subbtton").src="<%=path %>/reference/images/button_save.gif";
				document.getElementById("frm").action="<%=path %>/beike/cmonthcontent.do?method=updateMonthContent&cid="+tid;
				$("#cmonthContent").val($("#td"+tid).text());
				
			}
	</script>
 </head>  
  <body>
  <form action="${pageContext.request.contextPath}/beike/cmonthcontent.do?method=addMonthContent" name="frm" id="frm" method="post">
  <input type="hidden" id="month" name="month" value="<%=month %>" />
  <input type="hidden" id="targetId" name="targetId" value="${targetId }" />
  <input type="hidden" id="areaId" name="areaId" value="${areaId }" />
  <input type="hidden" id="edit" name="edit" value="${edit }" />
   	<div id="div1">
   				<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#cfe5f5">
   					<tr>
   						<td align="right" width="100">月主题名称：</td>
   						<td colspan="3" align="left"><input name="monthThemeName" type="text" value="${ monthThemeName }" size="100"/></td>
   					</tr>
   				</table>
   		       <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#cfe5f5">
                    <tr>
                      <td width="6%" height="25" bgcolor="#a4c9ec">&nbsp;序号</td>
                      <td width="66%" height="25" align="center" bgcolor="#a4c9ec"><strong>主题内容</strong></td>
                      <td width="11%" align="center" bgcolor="#a4c9ec"><strong>编 辑</strong></td>
                      <td width="17%" align="center" bgcolor="#a4c9ec"><strong>删 除</strong></td>
                    </tr>
                    
                    <c:forEach items="${monthcontent}" var="content" varStatus="staut">
	                     <tr>
		                      <td width="6%" height="30" bgcolor="#FFFFFF">${staut.count+(currPage-1)*pageSize }.</td>
		                      <td height="30" align="center" bgcolor="#FFFFFF" id="td${content.id }">${content.cmonthContent }</td>
		                      <td height="30" align="center" bgcolor="#FFFFFF"><a href="javascript:editcontent(${content.id });"><img src="<%=path %>/reference/images/bianji.gif" alt="" width="16" height="16" border="0"></a></td>
		                      <td height="30" align="center" bgcolor="#FFFFFF"><a href="javascript:delmonthcontent(${content.id });"><img src="<%=path %>/reference/images/de.gif" alt="" width="16" height="16" border="0"></a></td>
	                     </tr>
                    </c:forEach>
                    
                  </table>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                    <tr>
                      <td bgcolor="#e6f0f8"><table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                              <td align="right">
                              	<%
                              		String url = "/beike/cmonthcontent.do?method=initMonthContent";
                              		if(null!=request.getAttribute("edit")){
                              			url = "/beike/cmonthcontent.do?method=initMonthContentEdit";
                              		}	
                              		
                              		request.setAttribute("url",url);
                              	 %>
                            	<page:Pagination url="${pageContext.request.contextPath}${url }" currPage="${empty currPage?1:currPage}" pageAmount="${pageAmount}" pageSize="${empty pageSize?10:pageSize}" type="post" form="frm" />
						      </td>
                          </tr>
                      </table></td>
                    </tr>
                  </table>
                  
             <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                    <tr>
                      <td bgcolor="#e6f0f8"><table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                            <td width="68%" align="right"><input name="cmonthContent" id="cmonthContent" type="text"  style="width:100%" ></td>
                            <td width="32%"><a href="javascript:frm.submit();"><img src="<%=path %>/reference/images/button_add.gif" id="subbtton" width="44" height="20" border="0"></a></td>
                          </tr>
                      </table></td>
                    </tr>
            </table>
			
      </div>
      </form>
  </body>
</html>
